<?php
namespace frame\libs;

use frame\libs\Config;

/**
 * session类
 */
class Session {

    /**
     * 获取session
     * @param  [type] $name [description]
     * @param  [type] $file [description]
     * @return [type]       [description]
     */
    public static function get($name)
    {
        if (isset($_SESSION[ Config::get('prefix', 'authorize') . '_' . $name ])) {
            return $_SESSION[ Config::get('prefix', 'authorize') . '_' . $name ];
        }else{
            return '';
        }
    } 

    /**
     * 设置session
     * @param  [type] $file [description]
     * @return [type]       [description]
     */
    public static function set($name, $value)
    {
        $_SESSION[ Config::get('prefix', 'authorize') . '_' . $name ] = $value;
    }

    /**
     * 注销session
     * @param  [type] $name [description]
     * @return [type]       [description]
     */
    public function setNull($name)
    {
        $_SESSION[ Config::get('prefix', 'authorize') . '_' . $name ] = null;
    }

}

